package cmd

import (
	"os"

	"github.com/yggworldtree/go-server/engine"

	"gopkg.in/alecthomas/kingpin.v2"
)

const Version = "0.1.1"

var app = kingpin.New("ywtserver", "The YggWorldTree server")

func Run() {
	regs()
	kingpin.Version(Version)
	kingpin.MustParse(app.Parse(os.Args[1:]))
}

func regs() {
	cmd := app.Command("run", "run process").Default().
		Action(func(pc *kingpin.ParseContext) error {
			return run()
		})

	cmd.Flag("deamon", "deamon").Short('d').Bool()
}

func run() error {
	println("hello world")
	engine.Start()
	engine.Wait()
	return nil
}
